/**
 * 
 */
package com.dfhc.qbextend;

import java.util.Date;

import org.quickbundle.itf.base.IRmIdGenerator;
import org.quickbundle.project.RmGlobalReference;

import com.dfhc.ISystemConstant;
import com.dfhc.sequence.service.SequenceClientService;



/**
 * 任意版本序号产生器
 * 作者:龙色波
 * 日期:2015-01-21
 */
public class DBIdGenerator implements IRmIdGenerator {
   


   /* (non-Javadoc)
	 * @see org.quickbundle.itf.base.IRmIdGenerator#init()
	 */
	public void init() {
	}

	/* (non-Javadoc)
	 * @see org.quickbundle.itf.base.IRmIdGenerator#requestIdInner(java.lang.String, int)
	 */
	public String[] requestIdInner(String sequenceName, int seqNum) {
		String url=RmGlobalReference.get(ISystemConstant.DICTIONARY_SEQUENCE_CONFIG, ISystemConstant.DICTIONARY_SEQUENCE_URL);
		String systemTimeUrl = RmGlobalReference.get(ISystemConstant.DICTIONARY_SEQUENCE_CONFIG, ISystemConstant.DICTIONARY_SEQUENCE_CURRENT_TIME_URL);
		String sequence_domain= RmGlobalReference.get(ISystemConstant.DICTIONARY_SEQUENCE_CONFIG, ISystemConstant.DICTIONARY_SEQUENCE_DOMAIN);		
		Date d = SequenceClientService.getInstance().getCurrentTime(systemTimeUrl);
		return SequenceClientService.getInstance().getNextSequenceValue(url,seqNum, sequence_domain,sequenceName, d,d,d);
	}
}
